#pragma once
#include "Bee.h"
#include "Flower.h"
#include "Hive.h"

class CSpriteManager
{
public:
    CSpriteManager(void);
    CSpriteManager(CSpriteManager& spriteManager);
    ~CSpriteManager(void);
    const CSpriteManager& operator =(const CSpriteManager& spriteManager)
    {
        POSITION pos;

        m_listBees.RemoveAll();
        pos = spriteManager.m_listBees.GetHeadPosition();
        for(INT i = 0; i < spriteManager.m_listBees.GetCount(); i ++)
        {
            CBee bee = spriteManager.m_listBees.GetNext(pos);
            m_listBees.AddTail(bee);
        }

        m_listFlowers.RemoveAll();
        pos = spriteManager.m_listFlowers.GetHeadPosition();
        for(INT i = 0; i < spriteManager.m_listFlowers.GetCount(); i ++)
        {
            CFlower flower = spriteManager.m_listFlowers.GetNext(pos);
            m_listFlowers.AddTail(flower);
        }

        m_listHives.RemoveAll();
        pos = spriteManager.m_listHives.GetHeadPosition();
        for(INT i = 0; i < spriteManager.m_listHives.GetCount(); i ++)
        {
            CHive hive = spriteManager.m_listHives.GetNext(pos);
            m_listHives.AddTail(hive);
        }

        return spriteManager;
    }

    POSITION CreateBee(BOOL bIsPlayer);
    void DestroyBee(POSITION pos);
	void CreateFlower();
	void CreateHive();
	void DestroyBees();
	void DestroyFlowers();
    void BeeSelectTarget(CBee& bee);
    
    void Init();
    void Update();
    void Draw();

    void ControlBee(POSITION posClientSprite);

    void Serialize(CString& strMessage);
    BOOL Deserialize(CString& strMessage);

private:
    CList<CBee, CBee&> m_listBees;
    CList<CFlower, CFlower&> m_listFlowers;
    CList<CHive, CHive&> m_listHives;
    CCriticalSection m_critialSection;
};

